<script type="text/javascript" src="<?=base_url()?>resource/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    function updatecg(id){
        var zttext=$('#st' + id).val();
        var addname=$('#name' + id).text();
        var yname=$('#yname').val();
        if(addname != yname){
            alert("<?=lang('pcm_brdcgd')?>");
            return false;
        }
        if(zttext==3){
            alert("<?=lang('pcm_cgzbnxg')?>");
            return false;
        }
        if(zttext==4){
            alert("<?=lang('pcm_yfhbnxg')?>");
            return false;
        }
        switch($('#'+id).text()){
            case '<?=lang('public_editText')?>':
                var pjname = $('#pjname' + id).text();
                var pjtext = "<input type='text' id='pjtext" + id + "'size=50 value='" + pjname + "'" + ">";
                $('#pjname' + id).html(pjtext);
                var numeber = $('#numeber' + id).text();
                var numtext = "<input type='text' id='numtext" + id + "'size=1 value='" + numeber + "'" + ">";
                $('#numeber' + id).html(numtext);
                $('#'+id).text('<?=lang('public_qreditText')?>');
                break;
            case '<?=lang('public_qreditText')?>':
                var pjname=$('#pjtext'+id).val();
                var numeber=$('#numtext'+id).val();
                $.post("<?=blang_url('ajax/ajax/updatecg')?>", {'id':id,'pjname':pjname,'numeber':numeber},function(data){
                    switch (data){
                        case '1':
                            $('#pjname' + id).html(pjname);
                            $('#numeber' + id).html(numeber);
                            $('#'+id).text('<?=lang('public_editText')?>');
                            break;
                        case '0':
                            alert('Error：1！！！');
                            break;
                    }
                });
                break;
        }
    }
    function deletes(id){
        var zttext=$('#st' + id).val();
        var addname=$('#name' + id).text();
        var yname=$('#yname').val();
        if (addname != yname) {
            if(yname != 'romy') {
                alert("<?=lang('pcm_brdcgd')?>");
                return false;
            }
        }
        if(zttext==3){
            alert("<?=lang('pcm_cgzbnxg')?>");
            return false;
        }
        if(zttext==4){
            alert("<?=lang('pcm_yfhbnxg')?>");
            return false;
        }
        if(confirm('<?=lang('public_isqx')?>')) {
            return true;
        } else {
            return false;
        }
        $.get("/sc/products/material/scmtpcm/"+id,function(data){window.location.href= location.href;})
    }
    function gjpost(id){
        $("#"+id).submit();
    }
</script>
<script type="text/javascript" src="<?=base_url()?>resource/plugins/My97DatePicker/WdatePicker.js"></script>

<!--菜单 start-->
<?php $this->load->view('defaults/common/left');?>
<!--菜单 end-->
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <h1><?=lang('menu_cpgl')?></h1>
      <?=$this->breadcrumb->generateHTML();?>
    </div>
  </div>
  <div class="container-fluid">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i><?=lang('menu_wlcglb')?></h3>
      </div>
      <div class="panel-body">
        <div class="well" style="padding:0 19px;">
          <div class="row">
            <form action="<?=blang_url('imei/imeictl/imeilist/')?>" method="post" enctype="multipart/form-data" name="searchform" >
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="control-label">ID/sku/imei</label>
                        <input class="form-control" name="keyword"  placeholder="ID/sku/imei" />
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="control-label"><?=lang('product_wbkssj')?></label>
                        <input type="text" name="startTime" value="" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate" />
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        <label class="control-label"><?=lang('product_wbjssj')?></label>
                        <input type="text" name="endTime" value="" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate">
                    </div>
                    <input type="submit" name="searchSubmit" class="btn btn-primary pull-right" style="margin: 0 0 10px 10px;"  value="<?=lang('file_cx')?>" />
                    <a href="<?=blang_url('imei/imeictl/imeilist/'.$page.'/dachuyes')?>" class="btn btn-oms pull-right"><i class="fa fa-download"></i>&nbsp;<?=lang('public_dcexcel')?></a>
                </div>
            </form>
            
          </div>
        </div>
        <div class="well" style="padding:0 19px;">
          <div class="row">
            <form action="<?=blang_url('imei/imeictl/uploadimei')?>" method="post" name="searchform" enctype="multipart/form-data">
               <div class="form-group oms-group col-sm-12">
                    <input class="btn btn-oms pull-right" type="submit" name="button" id="button" onclick="return tijiao()" value="<?=lang('product_drexcel')?>">
                    <input class="pull-right" style="margin:8px 8px 0 0;width:210px;" type="file" name="fileField" id="fileField" />
                </div>
            </form>
          </div>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-hover oms-table">
              <thead>
                <tr>
                  <td class="text-left">id</td>
                  <td class="text-left">sku</td>
                  <td class="text-left">imei_1</td>
                  <td class="text-right">imei_2</td>
                  <td class="text-right"><?=lang('product_wbkssj')?></td>
                  <td class="text-right"><?=lang('product_wbjssj')?></td>
                </tr>
              </thead>
              <tbody>
                <?php if($imeilist): foreach ($imeilist as $key=>$rs):?>
                <tr>
                    <td class="text-left"><?=$rs['id']?></td>
                    <td class="text-left"><?=$rs['sku']?></td>
                    <td class="text-left"><?=$rs['imei_1']?></td>
                    <td class="text-right"><?=$rs['imei_2']?></td>
                    <td class="text-right"><?=$rs['warranty_start_date']?></td>
                    <td class="text-right"><?=$rs['warranty_end_date']?></td>
                </tr>
                <?php endforeach; else:?>
                    <tr><th colspan="6" class="emptyNumber"><?=lang('public_mygdsj')?>....</th></tr>
                <?php endif; ?>
            </tbody>
            </table>
            <?php if($pageshow):?>
            <div class="page">
                <?=$pageshow?>
            </div>
            <?php endif;?>
          </div>
      </div>
    </div>
    </div>
</div>